//
//  BSSViewTool.h
//  BrightSunnySky
//
//  Created by purang on 2018/12/11.
//  Copyright © 2018年 purang. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>

#define SCALEWFLOOR(x)  (floor([[UIScreen mainScreen] bounds].size.width*(x)/375.0)) // uilabel 在遇到width小数后数值有问题时 会出现黑边情况

typedef NS_ENUM(NSUInteger, BSSViewToolButtonPosition) {
    BSSViewToolButtonPositionTop = 0,
    BSSViewToolButtonPositionRight,
    BSSViewToolButtonPositionBottom,
    BSSViewToolButtonPositionLeft
};

@interface BSSViewTool : NSObject

/**
 创建label

 @param frame frame
  @param text text
 @param font font
 @param textColor textColor
  @param backgroundColor backgroundColor
 @param adjust 字体是否根据frame变化
 @param textAligenment 格式
 @return label
 */
+ (UILabel *)createLabelWithFrame:(CGRect)frame text:(NSString *)text font:(UIFont *)font textColor:(UIColor *)textColor backgroundColor:(UIColor *)backgroundColor autoAdjustFontSize:(BOOL)adjust textAligenment:(NSTextAlignment)textAligenment;

/**
 创建按钮

 @param frame frame
 @param titleFont titleFont
 @param titleColor titleColor
 @param normaleBackgroundImage normaleBackgroundImage
 @param highlightBackgroundImage highlightBackgroundImage
 @param normalImage normalImage
 @param highlightImage highlightImage
 @param backgroundColor backgroundColor
 @param obj obj
 @param sel sel
 @return 按钮
 */
+ (UIButton *)createButtonWithFrame:(CGRect)frame title:(NSString *)title titleFont:(UIFont *)titleFont titleColor:(UIColor *)titleColor normaleBackgroundImage:(UIImage *)normaleBackgroundImage highlightBackgroundImage:(UIImage *)highlightBackgroundImage normalImage:(UIImage *)normalImage highlightImage:(UIImage *)highlightImage backgroundColor:(UIColor *)backgroundColor actionTarget:(id)obj sel:(SEL)sel;

/**
 创建view

 @param frame frame
 @param backgroundColor backgroundColor
 @return view
 */
+ (UIView *)createViewWithFrame:(CGRect)frame backgroundColor:(UIColor *)backgroundColor;

/**
 修改view的边框和圆角

 @param borderColor 边框颜色
 @param borderWidth 边框宽度
 @param cornerRadius 圆角
 @param view view
 */
+ (void)transferViewBorderColor:(UIColor *)borderColor borderWidth:(CGFloat)borderWidth cornerRadius:(CGFloat)cornerRadius view:(UIView *)view;

/**
 计算文本的高度

 @param standardWidth 定的宽度
 @param text 文案
 @param attributes 属性
 @return 文本的高度
 */
+ (CGFloat)caculateStringHeight:(CGFloat)standardWidth text:(NSString *)text attributes:(NSDictionary *)attributes;

/**
 计算文本宽度

 @param standardHight 定的高度
 @param text 文案
 @param attributes 属性
 @return 文本的宽度
 */
+ (CGFloat)caculateStringWidth:(CGFloat)standardHight text:(NSString *)text attributes:(NSDictionary *)attributes;

/**
 修改按钮中文字和图案的位置

 @param position 图片位置
 @param button 按钮
 @param space 文字和title的间隔
 */
+ (void)buttonImagePosition:(BSSViewToolButtonPosition)position button:(UIButton *)button space:(CGFloat)space;

/// 给view加部分圆角
/// @param rect rect
/// @param corner 需要的角
/// @param radii 圆角半径
/// @param view view
+ (void)rectCorners:(UIRectCorner)corner cornerRadii:(CGSize)radii view:(UIView *)view;

@end
